//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.ryzom.nel.misc;

public class IStream {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public IStream(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(IStream obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_IStream(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public static void setVersionException(boolean throwOnOlder, boolean throwOnNewer) {
    nelmiscJNI.IStream_setVersionException(throwOnOlder, throwOnNewer);
  }

  public static void getVersionException(SWIGTYPE_p_bool throwOnOlder, SWIGTYPE_p_bool throwOnNewer) {
    nelmiscJNI.IStream_getVersionException(SWIGTYPE_p_bool.getCPtr(throwOnOlder), SWIGTYPE_p_bool.getCPtr(throwOnNewer));
  }

  public IStream assign(IStream other) {
    return new IStream(nelmiscJNI.IStream_assign(swigCPtr, this, IStream.getCPtr(other), other), false);
  }

  public void swap(IStream other) {
    nelmiscJNI.IStream_swap(swigCPtr, this, IStream.getCPtr(other), other);
  }

  public boolean isReading() {
    return nelmiscJNI.IStream_isReading(swigCPtr, this);
  }

  public boolean isXML() {
    return nelmiscJNI.IStream_isXML(swigCPtr, this);
  }

  public void serial(SWIGTYPE_p_unsigned_char b) {
    nelmiscJNI.IStream_serial__SWIG_1(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b));
  }
/*
  public void serial(SWIGTYPE_p_char b) {
    nelmiscJNI.IStream_serial__SWIG_2(swigCPtr, this, SWIGTYPE_p_char.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_unsigned_int b) {
    nelmiscJNI.IStream_serial__SWIG_3(swigCPtr, this, SWIGTYPE_p_unsigned_int.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_int b) {
    nelmiscJNI.IStream_serial__SWIG_4(swigCPtr, this, SWIGTYPE_p_int.getCPtr(b));
  }
*/
  public void serial(SWIGTYPE_p_unsigned_int b) {
    nelmiscJNI.IStream_serial__SWIG_5(swigCPtr, this, SWIGTYPE_p_unsigned_int.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_int b) {
    nelmiscJNI.IStream_serial__SWIG_6(swigCPtr, this, SWIGTYPE_p_int.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_unsigned_long_long b) {
    nelmiscJNI.IStream_serial__SWIG_7(swigCPtr, this, SWIGTYPE_p_unsigned_long_long.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_long_long b) {
    nelmiscJNI.IStream_serial__SWIG_8(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_float b) {
    nelmiscJNI.IStream_serial__SWIG_9(swigCPtr, this, SWIGTYPE_p_float.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_double b) {
    nelmiscJNI.IStream_serial__SWIG_10(swigCPtr, this, SWIGTYPE_p_double.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_bool b) {
    nelmiscJNI.IStream_serial__SWIG_11(swigCPtr, this, SWIGTYPE_p_bool.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_char b) {
    nelmiscJNI.IStream_serial__SWIG_12(swigCPtr, this, SWIGTYPE_p_char.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_std__string b) {
    nelmiscJNI.IStream_serial__SWIG_13(swigCPtr, this, SWIGTYPE_p_std__string.getCPtr(b));
  }

  public void serial(ucstring b) {
    nelmiscJNI.IStream_serial__SWIG_14(swigCPtr, this, ucstring.getCPtr(b), b);
  }

  public void serialMemStream(CMemStream b) {
    nelmiscJNI.IStream_serialMemStream(swigCPtr, this, CMemStream.getCPtr(b), b);
  }

  public short serialBitField8(short bf) {
    return nelmiscJNI.IStream_serialBitField8(swigCPtr, this, bf);
  }

  public long serialBitField16(long bf) {
    return nelmiscJNI.IStream_serialBitField16(swigCPtr, this, bf);
  }

  public long serialBitField32(long bf) {
    return nelmiscJNI.IStream_serialBitField32(swigCPtr, this, bf);
  }

  public void serialCont(SWIGTYPE_p_std__vectorT_unsigned_char_t cont) {
    nelmiscJNI.IStream_serialCont__SWIG_8(swigCPtr, this, SWIGTYPE_p_std__vectorT_unsigned_char_t.getCPtr(cont));
  }

  public void serialCont(SWIGTYPE_p_std__vectorT_char_t cont) {
    nelmiscJNI.IStream_serialCont__SWIG_9(swigCPtr, this, SWIGTYPE_p_std__vectorT_char_t.getCPtr(cont));
  }

  public void serialCont(SWIGTYPE_p_std__vectorT_bool_t cont) {
    nelmiscJNI.IStream_serialCont__SWIG_10(swigCPtr, this, SWIGTYPE_p_std__vectorT_bool_t.getCPtr(cont));
  }

  public long serialVersion(long currentVersion) {
    return nelmiscJNI.IStream_serialVersion(swigCPtr, this, currentVersion);
  }

  public boolean seek(int offset, IStream.TSeekOrigin origin) {
    return nelmiscJNI.IStream_seek(swigCPtr, this, offset, origin.swigValue());
  }

  public int getPos() {
    return nelmiscJNI.IStream_getPos(swigCPtr, this);
  }

  public String getStreamName() {
    return nelmiscJNI.IStream_getStreamName(swigCPtr, this);
  }

  public boolean xmlPush(String name) {
    return nelmiscJNI.IStream_xmlPush(swigCPtr, this, name);
  }

  public boolean xmlPushBegin(String name) {
    return nelmiscJNI.IStream_xmlPushBegin(swigCPtr, this, name);
  }

  public boolean xmlPushEnd() {
    return nelmiscJNI.IStream_xmlPushEnd(swigCPtr, this);
  }

  public boolean xmlPop() {
    return nelmiscJNI.IStream_xmlPop(swigCPtr, this);
  }

  public boolean xmlSetAttrib(String name) {
    return nelmiscJNI.IStream_xmlSetAttrib(swigCPtr, this, name);
  }

  public boolean xmlBreakLine() {
    return nelmiscJNI.IStream_xmlBreakLine(swigCPtr, this);
  }

  public boolean xmlComment(String comment) {
    return nelmiscJNI.IStream_xmlComment(swigCPtr, this, comment);
  }

  public void serialBuffer(SWIGTYPE_p_unsigned_char buf, long len) {
    nelmiscJNI.IStream_serialBuffer(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(buf), len);
  }

  public void serialBit(SWIGTYPE_p_bool bit) {
    nelmiscJNI.IStream_serialBit(swigCPtr, this, SWIGTYPE_p_bool.getCPtr(bit));
  }

  public void serialBufferWithSize(SWIGTYPE_p_unsigned_char buf, long len) {
    nelmiscJNI.IStream_serialBufferWithSize(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(buf), len);
  }

  public final static class TSeekOrigin {
    public final static TSeekOrigin begin = new TSeekOrigin("begin");
    public final static TSeekOrigin current = new TSeekOrigin("current");
    public final static TSeekOrigin end = new TSeekOrigin("end");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TSeekOrigin swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TSeekOrigin.class + " with value " + swigValue);
    }

    private TSeekOrigin(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TSeekOrigin(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TSeekOrigin(String swigName, TSeekOrigin swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TSeekOrigin[] swigValues = { begin, current, end };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
